<template>
  <div class="page">

    <div class="demo">
      <h2>树形控件-normal</h2>
      <div class="viewer">
        <cms-tree 
          :data="tree.data"
          node-key="id"
          :default-expand-all="true"
          :default-expanded-keys="[2, 3]"
          :default-checked-keys="[5,7]"
          :props="tree.defaultProps"
        />
      </div>
    </div>
    <div class="demo">
      <h2>树形控件2-formal</h2>
      <div class="viewer">
        <formal-tree
          :data="tree.data"
          node-key="id"
          :default-expand-all="true"
          :props="tree.defaultProps"
        />
      </div>
    </div>
    <div class="demo">
      <h2>树形控件3-folder</h2>
      <div class="viewer">
        <folder-tree
          :data="tree.data"
          node-key="id"
          :default-expand-all="true"
          :props="tree.defaultProps"
        />
      </div>
    </div>

  </div>
</template>

<script setup lang="ts">
import CmsTree from 'components/common/CmsTree/normal.vue'
import FormalTree from 'components/common/CmsTree/formal.vue'
import FolderTree from 'components/common/CmsTree/folder.vue'
import { reactive, ref } from 'vue'

let tree = reactive({
  data: [
    {
      id: 1,
      label: '一级 1',
      children: [{
        id: 4,
        label: '二级 1-1',
        children: [{
          id: 9,
          label: '三级三级三级三级三级三级三级三级 1-1-1'
        }, {
          id: 10,
          label: '三级 1-1-2'
        }]
      }]
    },{
      id: 2,
      label: '一级 2',
      children: [{
        id: 5,
        label: '二级 2-1'
      }, {
        id: 6,
        label: '二级 2-2'
      }]
    },{
      id: 3,
      label: '一级 3',
      children: [{
        id: 7,
        label: '二级 3-1',
        disabled: true
      }, {
        id: 8,
        label: '二级 3-2',
        disabled: true
      }]
    },
  ],
  defaultProps: {
    children: 'children',
    label: 'label'
  }
});
const changePage = (num:number)=>{
  console.log("回调，当前页码", num)
}
</script>
<style lang="scss" scoped>
.page{
  padding: 0 20px;
}
.demo{
  width: 250px;
  margin-right: 10px;
  display: inline-block;
}
.viewer{
  background-color: #fff;
  height: 400px;
  padding: 10px;
  overflow: auto;
}
</style>
